package com.sxh.user.feign;

import com.sxh.user.result.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;
//rpc调用
@FeignClient(value = "permission")
public interface UserFeignClient {

    // 绑定默认角色接口
    @GetMapping("/permission/{id}")
    public Result bindDefaultRole(@PathVariable("id") Long id);
    //根据权限查询用户id
    @GetMapping("/permission/queryUserIdByRoleId/{roleCode}")
    public List<Long> queryUserIdByRoleId(@PathVariable("roleCode")String rodeCode);
    //查询用户的角色码
    @GetMapping("/permission/getUserRoleCode/{id}")
    public String getUserRoleCode(@PathVariable("id") Long id);
    // 超管调用：升级用户为管理员
    @GetMapping("/permission/upgradeToAdmin/{userId}")
    public void upgradeToAdmin(@PathVariable("userId") Long userId);
    // 超管调用：降级用户为普通角色
    @GetMapping("/permission/downgradeToUser/{userId}")
    public void downgradeToUser(@PathVariable("userId")Long userId);

}
